import request from '@/utils/request'

// 获取计划列表
export function listPlanPage(data) {
  return request({
    url: '/plan/list',
    method: 'get',
    params: data
  })
}

//方案生效
export function effectPlan(planId) {
  return request({
    url: '/plan/effectPlan/' + planId,
    method: 'post'
  })
}

// 删除
export function deletePlan(id) {
  return request({
    url: '/plan/' + id,
    method: 'delete'
  })
}

// 保存
export function savePlan(data) {
  return request({
    url: '/plan',
    method: 'post',
    data: data
  })
}

// 更新

export function updatePlan(data) {
  return request({
    url: "/plan/" + data.id,
    method: 'put',
    data: data
  })
}

// 查询tempId
export function getNewTempId(data) {
  return request({
    url: '/plan/getNewTempId',
    method: 'get',
    params: data
  })
}

export function getPlanFile(data) {
  return request({
    url: '/planFile/getPlanFile',
    method: 'get',
    params: data
  })
}

export function deletePlanFile(id) {
  return request({
    url: '/planFile/' + id,
    method: 'delete',
  })
}

export function getPlanFilePage(data) {
  return request({
    url: '/planFile/getPlanFilePage',
    method: 'get',
    params: data
  })
}

export function downloadPlanFile(data) {
  return request({
    url: '/planFile/downloadPlanFile',
    method: 'post',
    data: data,
    responseType: 'arraybuffer',
  })
}

export function updatePlanFile(data) {
  return request({
    url: '/planFile/' + data.id,
    method: 'put',
    data: data
  })
}

export function queryEffectFile(data) {
  return request({
    url: '/plan/queryEffectFile',
    method: 'get',
    params: data
  })
}